/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2019
 */

package net.dreamlu.db.qo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Date;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Order;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.criterion.MatchMode;
import org.springframework.data.jpa.domain.Specification;
import net.dreamlu.db.po.*;
/**
 *
 * @author lambert.wang email:lambert.wang(a)crediteyes.com
 * @version 1.0
 * @since 1.0
 */
public class SysDictQuery extends SysDict implements Serializable {
    private static final long serialVersionUID = 3148176768559230877L;
    

	/** 编码ID */
	private java.lang.Integer id;	
	private java.lang.Integer notEqId;	
	/** 类别 */
	private String likeDictTypeWithStart;
	private String likeDictTypeWithEnd;
	private String likeDictTypeWithExact;
	private String likeDictTypeWithAnywhere;
	private java.lang.String dictType;	
	private java.lang.String notEqDictType;	
	/** 描述 */
	private String likeDictDescWithStart;
	private String likeDictDescWithEnd;
	private String likeDictDescWithExact;
	private String likeDictDescWithAnywhere;
	private java.lang.String dictDesc;	
	private java.lang.String notEqDictDesc;	
	/** 键 */
	private String likeDictKeyWithStart;
	private String likeDictKeyWithEnd;
	private String likeDictKeyWithExact;
	private String likeDictKeyWithAnywhere;
	private java.lang.String dictKey;	
	private java.lang.String notEqDictKey;	
	/** 值 */
	private String likeDictValueWithStart;
	private String likeDictValueWithEnd;
	private String likeDictValueWithExact;
	private String likeDictValueWithAnywhere;
	private java.lang.String dictValue;	
	private java.lang.String notEqDictValue;	
	/** 排序 */
	private Integer seq;	
	private Integer notEqSeq;	
	/** 创建时间 */
	private java.time.LocalDateTime createTimeBegin;
	private java.time.LocalDateTime createTimeEnd;	
	private java.time.LocalDateTime createTime;	
	private java.time.LocalDateTime notEqCreateTime;	
	
	/*********** 系统属性，自动赋值 *********/
	private boolean isId;
	private boolean isNotEqId;
	private MatchMode likedictType;
	private boolean isDictType;
	private boolean isNotEqDictType;
	private MatchMode likedictDesc;
	private boolean isDictDesc;
	private boolean isNotEqDictDesc;
	private MatchMode likedictKey;
	private boolean isDictKey;
	private boolean isNotEqDictKey;
	private MatchMode likedictValue;
	private boolean isDictValue;
	private boolean isNotEqDictValue;
	private boolean isSeq;
	private boolean isNotEqSeq;
	private boolean isCreateTimeBegin;
	private boolean isCreateTimeEnd;
	private boolean isCreateTime;
	private boolean isNotEqCreateTime;
	private java.lang.Integer ltCriterionId;
	public void setLtId(java.lang.Integer id){
		ltCriterionId = id;
	}
	public java.lang.Integer getLtId(){
		return ltCriterionId;
	}
	private java.lang.Integer leCriterionId;
	public void setLeId(java.lang.Integer id){
		leCriterionId = id;
	}
	public java.lang.Integer getLeId(){
		return leCriterionId;
	}
	private java.lang.Integer gtCriterionId;
	public void setGtId(java.lang.Integer id){
		gtCriterionId = id;
	}
	public java.lang.Integer getGtId(){
		return gtCriterionId;
	}
	private java.lang.Integer geCriterionId;
	public void setGeId(java.lang.Integer id){
		geCriterionId = id;
	}
	public java.lang.Integer getGeId(){
		return geCriterionId;
	}
	public java.lang.Integer getId() {
		return this.id;
	}
	
	public void setId(java.lang.Integer value) {		
		this.id = value;
		this.isId = true;
	}
	public boolean hasId() {
		return this.isId;
	}
	public java.lang.Integer getNotEqId() {
		return this.notEqId;
	}
	public void setNotEqId(java.lang.Integer id) {
		this.notEqId = id;
		this.isNotEqId = true;
	}
	public boolean hasNotEqId() {
		return this.isNotEqId;
	}
	// IN or notIN
	private List<java.lang.Integer>	inCriterionId;
	private List<java.lang.Integer>	notInCriterionId;
	public void setInId(boolean isIn,List<java.lang.Integer> ids){
		if(isIn){
			inCriterionId = ids;
		}else{
			notInCriterionId = ids;
		}
	}
	public List<java.lang.Integer> getInId() {
		return inCriterionId;
	}
	public List<java.lang.Integer> getNotInId() {
		return notInCriterionId;
	}
	
	//Null or NotNull
	private Boolean nullCriterionId;
	public void setNullId(boolean isNull){
			nullCriterionId = isNull;
	}
	public Boolean getNullId(){
		return nullCriterionId;
	} 
	
	public MatchMode getLikeDictType() {
		return this.likedictType;
	}
	public String getLikeDictTypeWithStart() {
		return this.likeDictTypeWithStart;
	}
	public void setLikeDictTypeWithStart(String dictType) {	
		setDictType(dictType);
		setLikeDictType(MatchMode.START);
	}
	public String getLikeDictTypeWithEnd() {
		return this.likeDictTypeWithEnd;
	}
	public void setLikeDictTypeWithEnd(String dictType) {	
		setDictType(dictType);
		setLikeDictType(MatchMode.END);
	}
	public String getLikeDictTypeWithExact() {
		return this.likeDictTypeWithExact;
	}
	public void setLikeDictTypeWithExact(String dictType) {	
		setDictType(dictType);
		setLikeDictType(MatchMode.EXACT);
	}
	public String getLikeDictTypeWithAnywhere() {
		return this.likeDictTypeWithAnywhere;
	}
	public void setLikeDictTypeWithAnywhere(String dictType) {	
		setDictType(dictType);
		setLikeDictType(MatchMode.ANYWHERE);
	}
	private void setLikeDictType(MatchMode matchMode) {		
		this.likedictType = matchMode;
	}
	public java.lang.String getDictType() {
		return this.dictType;
	}
	
	public void setDictType(java.lang.String value) {		
		this.dictType = value;
		this.isDictType = true;
	}
	public boolean hasDictType() {
		return this.isDictType;
	}
	public java.lang.String getNotEqDictType() {
		return this.notEqDictType;
	}
	public void setNotEqDictType(java.lang.String dictType) {
		this.notEqDictType = dictType;
		this.isNotEqDictType = true;
	}
	public boolean hasNotEqDictType() {
		return this.isNotEqDictType;
	}
	// IN or notIN
	private List<java.lang.String>	inCriterionDictType;
	private List<java.lang.String>	notInCriterionDictType;
	public void setInDictType(boolean isIn,List<java.lang.String> dictTypes){
		if(isIn){
			inCriterionDictType = dictTypes;
		}else{
			notInCriterionDictType = dictTypes;
		}
	}
	public List<java.lang.String> getInDictType() {
		return inCriterionDictType;
	}
	public List<java.lang.String> getNotInDictType() {
		return notInCriterionDictType;
	}
	
	//Null or NotNull
	private Boolean nullCriterionDictType;
	public void setNullDictType(boolean isNull){
			nullCriterionDictType = isNull;
	}
	public Boolean getNullDictType(){
		return nullCriterionDictType;
	} 
	
	public MatchMode getLikeDictDesc() {
		return this.likedictDesc;
	}
	public String getLikeDictDescWithStart() {
		return this.likeDictDescWithStart;
	}
	public void setLikeDictDescWithStart(String dictDesc) {	
		setDictDesc(dictDesc);
		setLikeDictDesc(MatchMode.START);
	}
	public String getLikeDictDescWithEnd() {
		return this.likeDictDescWithEnd;
	}
	public void setLikeDictDescWithEnd(String dictDesc) {	
		setDictDesc(dictDesc);
		setLikeDictDesc(MatchMode.END);
	}
	public String getLikeDictDescWithExact() {
		return this.likeDictDescWithExact;
	}
	public void setLikeDictDescWithExact(String dictDesc) {	
		setDictDesc(dictDesc);
		setLikeDictDesc(MatchMode.EXACT);
	}
	public String getLikeDictDescWithAnywhere() {
		return this.likeDictDescWithAnywhere;
	}
	public void setLikeDictDescWithAnywhere(String dictDesc) {	
		setDictDesc(dictDesc);
		setLikeDictDesc(MatchMode.ANYWHERE);
	}
	private void setLikeDictDesc(MatchMode matchMode) {		
		this.likedictDesc = matchMode;
	}
	public java.lang.String getDictDesc() {
		return this.dictDesc;
	}
	
	public void setDictDesc(java.lang.String value) {		
		this.dictDesc = value;
		this.isDictDesc = true;
	}
	public boolean hasDictDesc() {
		return this.isDictDesc;
	}
	public java.lang.String getNotEqDictDesc() {
		return this.notEqDictDesc;
	}
	public void setNotEqDictDesc(java.lang.String dictDesc) {
		this.notEqDictDesc = dictDesc;
		this.isNotEqDictDesc = true;
	}
	public boolean hasNotEqDictDesc() {
		return this.isNotEqDictDesc;
	}
	// IN or notIN
	private List<java.lang.String>	inCriterionDictDesc;
	private List<java.lang.String>	notInCriterionDictDesc;
	public void setInDictDesc(boolean isIn,List<java.lang.String> dictDescs){
		if(isIn){
			inCriterionDictDesc = dictDescs;
		}else{
			notInCriterionDictDesc = dictDescs;
		}
	}
	public List<java.lang.String> getInDictDesc() {
		return inCriterionDictDesc;
	}
	public List<java.lang.String> getNotInDictDesc() {
		return notInCriterionDictDesc;
	}
	
	//Null or NotNull
	private Boolean nullCriterionDictDesc;
	public void setNullDictDesc(boolean isNull){
			nullCriterionDictDesc = isNull;
	}
	public Boolean getNullDictDesc(){
		return nullCriterionDictDesc;
	} 
	
	public MatchMode getLikeDictKey() {
		return this.likedictKey;
	}
	public String getLikeDictKeyWithStart() {
		return this.likeDictKeyWithStart;
	}
	public void setLikeDictKeyWithStart(String dictKey) {	
		setDictKey(dictKey);
		setLikeDictKey(MatchMode.START);
	}
	public String getLikeDictKeyWithEnd() {
		return this.likeDictKeyWithEnd;
	}
	public void setLikeDictKeyWithEnd(String dictKey) {	
		setDictKey(dictKey);
		setLikeDictKey(MatchMode.END);
	}
	public String getLikeDictKeyWithExact() {
		return this.likeDictKeyWithExact;
	}
	public void setLikeDictKeyWithExact(String dictKey) {	
		setDictKey(dictKey);
		setLikeDictKey(MatchMode.EXACT);
	}
	public String getLikeDictKeyWithAnywhere() {
		return this.likeDictKeyWithAnywhere;
	}
	public void setLikeDictKeyWithAnywhere(String dictKey) {	
		setDictKey(dictKey);
		setLikeDictKey(MatchMode.ANYWHERE);
	}
	private void setLikeDictKey(MatchMode matchMode) {		
		this.likedictKey = matchMode;
	}
	public java.lang.String getDictKey() {
		return this.dictKey;
	}
	
	public void setDictKey(java.lang.String value) {		
		this.dictKey = value;
		this.isDictKey = true;
	}
	public boolean hasDictKey() {
		return this.isDictKey;
	}
	public java.lang.String getNotEqDictKey() {
		return this.notEqDictKey;
	}
	public void setNotEqDictKey(java.lang.String dictKey) {
		this.notEqDictKey = dictKey;
		this.isNotEqDictKey = true;
	}
	public boolean hasNotEqDictKey() {
		return this.isNotEqDictKey;
	}
	// IN or notIN
	private List<java.lang.String>	inCriterionDictKey;
	private List<java.lang.String>	notInCriterionDictKey;
	public void setInDictKey(boolean isIn,List<java.lang.String> dictKeys){
		if(isIn){
			inCriterionDictKey = dictKeys;
		}else{
			notInCriterionDictKey = dictKeys;
		}
	}
	public List<java.lang.String> getInDictKey() {
		return inCriterionDictKey;
	}
	public List<java.lang.String> getNotInDictKey() {
		return notInCriterionDictKey;
	}
	
	//Null or NotNull
	private Boolean nullCriterionDictKey;
	public void setNullDictKey(boolean isNull){
			nullCriterionDictKey = isNull;
	}
	public Boolean getNullDictKey(){
		return nullCriterionDictKey;
	} 
	
	public MatchMode getLikeDictValue() {
		return this.likedictValue;
	}
	public String getLikeDictValueWithStart() {
		return this.likeDictValueWithStart;
	}
	public void setLikeDictValueWithStart(String dictValue) {	
		setDictValue(dictValue);
		setLikeDictValue(MatchMode.START);
	}
	public String getLikeDictValueWithEnd() {
		return this.likeDictValueWithEnd;
	}
	public void setLikeDictValueWithEnd(String dictValue) {	
		setDictValue(dictValue);
		setLikeDictValue(MatchMode.END);
	}
	public String getLikeDictValueWithExact() {
		return this.likeDictValueWithExact;
	}
	public void setLikeDictValueWithExact(String dictValue) {	
		setDictValue(dictValue);
		setLikeDictValue(MatchMode.EXACT);
	}
	public String getLikeDictValueWithAnywhere() {
		return this.likeDictValueWithAnywhere;
	}
	public void setLikeDictValueWithAnywhere(String dictValue) {	
		setDictValue(dictValue);
		setLikeDictValue(MatchMode.ANYWHERE);
	}
	private void setLikeDictValue(MatchMode matchMode) {		
		this.likedictValue = matchMode;
	}
	public java.lang.String getDictValue() {
		return this.dictValue;
	}
	
	public void setDictValue(java.lang.String value) {		
		this.dictValue = value;
		this.isDictValue = true;
	}
	public boolean hasDictValue() {
		return this.isDictValue;
	}
	public java.lang.String getNotEqDictValue() {
		return this.notEqDictValue;
	}
	public void setNotEqDictValue(java.lang.String dictValue) {
		this.notEqDictValue = dictValue;
		this.isNotEqDictValue = true;
	}
	public boolean hasNotEqDictValue() {
		return this.isNotEqDictValue;
	}
	// IN or notIN
	private List<java.lang.String>	inCriterionDictValue;
	private List<java.lang.String>	notInCriterionDictValue;
	public void setInDictValue(boolean isIn,List<java.lang.String> dictValues){
		if(isIn){
			inCriterionDictValue = dictValues;
		}else{
			notInCriterionDictValue = dictValues;
		}
	}
	public List<java.lang.String> getInDictValue() {
		return inCriterionDictValue;
	}
	public List<java.lang.String> getNotInDictValue() {
		return notInCriterionDictValue;
	}
	
	//Null or NotNull
	private Boolean nullCriterionDictValue;
	public void setNullDictValue(boolean isNull){
			nullCriterionDictValue = isNull;
	}
	public Boolean getNullDictValue(){
		return nullCriterionDictValue;
	} 
	
	public Integer getSeq() {
		return this.seq;
	}
	
	public void setSeq(Integer value) {		
		this.seq = value;
		this.isSeq = true;
	}
	public boolean hasSeq() {
		return this.isSeq;
	}
	public Integer getNotEqSeq() {
		return this.notEqSeq;
	}
	public void setNotEqSeq(Integer seq) {
		this.notEqSeq = seq;
		this.isNotEqSeq = true;
	}
	public boolean hasNotEqSeq() {
		return this.isNotEqSeq;
	}
	// IN or notIN
	private List<Integer>	inCriterionSeq;
	private List<Integer>	notInCriterionSeq;
	public void setInSeq(boolean isIn,List<Integer> seqs){
		if(isIn){
			inCriterionSeq = seqs;
		}else{
			notInCriterionSeq = seqs;
		}
	}
	public List<Integer> getInSeq() {
		return inCriterionSeq;
	}
	public List<Integer> getNotInSeq() {
		return notInCriterionSeq;
	}
	
	//Null or NotNull
	private Boolean nullCriterionSeq;
	public void setNullSeq(boolean isNull){
			nullCriterionSeq = isNull;
	}
	public Boolean getNullSeq(){
		return nullCriterionSeq;
	} 
	
	public java.time.LocalDateTime getCreateTimeBegin() {
		return this.createTimeBegin;
	}
	
	public void setCreateTimeBegin(java.time.LocalDateTime value) {
		this.createTimeBegin = value;
		this.isCreateTimeBegin = true;
	}	
	
	public java.time.LocalDateTime getCreateTimeEnd() {
		return this.createTimeEnd;
	}
	
	public void setCreateTimeEnd(java.time.LocalDateTime value) {
		this.createTimeEnd = value;
		this.isCreateTimeEnd = true;
	}
	public boolean hasCreateTimeBegin() {
		return this.isCreateTimeBegin;
	}
	public boolean hasCreateTimeEnd() {
		return this.isCreateTimeEnd;
	}	
	public java.time.LocalDateTime getCreateTime() {
		return this.createTime;
	}
	
	public void setCreateTime(java.time.LocalDateTime value) {		
		this.createTime = value;
		this.isCreateTime = true;
	}
	public boolean hasCreateTime() {
		return this.isCreateTime;
	}
	public java.time.LocalDateTime getNotEqCreateTime() {
		return this.notEqCreateTime;
	}
	public void setNotEqCreateTime(java.time.LocalDateTime createTime) {
		this.notEqCreateTime = createTime;
		this.isNotEqCreateTime = true;
	}
	public boolean hasNotEqCreateTime() {
		return this.isNotEqCreateTime;
	}
	// IN or notIN
	private List<java.time.LocalDateTime>	inCriterionCreateTime;
	private List<java.time.LocalDateTime>	notInCriterionCreateTime;
	public void setInCreateTime(boolean isIn,List<java.time.LocalDateTime> createTimes){
		if(isIn){
			inCriterionCreateTime = createTimes;
		}else{
			notInCriterionCreateTime = createTimes;
		}
	}
	public List<java.time.LocalDateTime> getInCreateTime() {
		return inCriterionCreateTime;
	}
	public List<java.time.LocalDateTime> getNotInCreateTime() {
		return notInCriterionCreateTime;
	}
	
	//Null or NotNull
	private Boolean nullCriterionCreateTime;
	public void setNullCreateTime(boolean isNull){
			nullCriterionCreateTime = isNull;
	}
	public Boolean getNullCreateTime(){
		return nullCriterionCreateTime;
	} 
	
	private List<String> listOrderAsc = new ArrayList<>();
	private List<String> listOrderDesc = new ArrayList<>();

	public void setOrderAsc(String fdName) {
		listOrderAsc.add(fdName);
	}

	public void setOrderDec(String fdName) {
		listOrderDesc.add(fdName);
	}

	public List<String> getOrderAscList() {
		return listOrderAsc;
	}

	public List<String> getOrderDecList() {
		return listOrderDesc;
	}
	
	
	/**
	 * 获取查询条件
	 */
	public Specification<SysDict> createSpecification() {
		Specification<SysDict> example = (root, query, criteriaBuilder) -> {
			List<Order> orders = new ArrayList<>();
			for (String asc : this.getOrderAscList()) {
				orders.add(criteriaBuilder.asc(root.get(asc)));
			}
			for (String desc : this.getOrderDecList()) {
				orders.add(criteriaBuilder.desc(root.get(desc)));
			}
			query.orderBy(orders);
			List<Predicate> predicates = createQuery(root, this, criteriaBuilder);
			hookQuery(root, criteriaBuilder,predicates);
			return query.where(predicates.toArray(new Predicate[predicates.size()])).getRestriction();
		};
		return example;
	}
	/**
	 * <p>
	 * <p>自定义的方法时候实现此方法即可(内部类方式使用即可)
	 * <p>使用方法: predicates.add(criteriaBuilder.equal(root.get("biaoqian").as(String.class), "value"));
	 * @param root
	 * @param query
	 * @param criteriaBuilder
	 * @param predicates
	 */
	public void hookQuery(Root<SysDict> root, CriteriaBuilder criteriaBuilder,List<Predicate> predicates) {}
	/**
	 * 组装query对象
	 * 
	 * @param root
	 * @param SysDictQuery
	 * @param criteriaBuilder
	 * @return
	 */
	private List<Predicate> createQuery(Root<SysDict> root, SysDictQuery query, CriteriaBuilder criteriaBuilder) {
		List<Predicate> predicates = new ArrayList<Predicate>();
		/**
		 * idExpression
		 */
		Expression<java.lang.Integer> idExpression = root.get(SysDict.PROP_ID).as(java.lang.Integer.class);
		if (query.hasId()) {
			java.lang.Integer value = query.getId();
			if( value != null){
				predicates.add(criteriaBuilder.equal(idExpression, value));					
			}
		}
		if (query.hasNotEqId()) {
			java.lang.Integer value = query.getNotEqId();
			predicates.add(criteriaBuilder.notEqual(idExpression, value));
		}
		
		if(query.getLeId()!=null){
			predicates.add(criteriaBuilder.le(idExpression, query.getLeId()));
		}
		if(query.getGeId()!=null){
			predicates.add(criteriaBuilder.ge(idExpression, query.getGeId()));
		}
		if(query.getLtId()!=null){
			predicates.add(criteriaBuilder.lt(idExpression, query.getLtId()));
		}
		if(query.getGtId()!=null){
			predicates.add(criteriaBuilder.gt(idExpression, query.getGtId()));
		}
		
		if (query.getInId() != null) {
			predicates.add(idExpression.in(query.getInId()));
		}
		if (query.getNotInId() != null) {
			predicates.add(criteriaBuilder.not(idExpression.in(query.getInId())));
		}
		if (query.getNullId() != null) {
			if (query.getNullId()) {
				predicates.add(criteriaBuilder.isNull(idExpression));
			} else {
				predicates.add(criteriaBuilder.isNotNull(idExpression));
			}
		}
		/**
		 * dictTypeExpression
		 */
		Expression<java.lang.String> dictTypeExpression = root.get(SysDict.PROP_DICT_TYPE).as(java.lang.String.class);
		if (query.hasDictType()) {
			java.lang.String value = query.getDictType();
			if (query.getLikeDictType() != null) {
				predicates.add(criteriaBuilder.like(dictTypeExpression, query.getLikeDictType().toMatchString(value)));
			} else {
				predicates.add(criteriaBuilder.equal(dictTypeExpression, value));
			}
		}
		if (query.hasNotEqDictType()) {
			java.lang.String value = query.getNotEqDictType();
			predicates.add(criteriaBuilder.notEqual(dictTypeExpression, value));
		}
		
		if (query.getInDictType() != null) {
			predicates.add(dictTypeExpression.in(query.getInDictType()));
		}
		if (query.getNotInDictType() != null) {
			predicates.add(criteriaBuilder.not(dictTypeExpression.in(query.getInDictType())));
		}
		if (query.getNullDictType() != null) {
			if (query.getNullDictType()) {
				predicates.add(criteriaBuilder.isNull(dictTypeExpression));
			} else {
				predicates.add(criteriaBuilder.isNotNull(dictTypeExpression));
			}
		}
		/**
		 * dictDescExpression
		 */
		Expression<java.lang.String> dictDescExpression = root.get(SysDict.PROP_DICT_DESC).as(java.lang.String.class);
		if (query.hasDictDesc()) {
			java.lang.String value = query.getDictDesc();
			if (query.getLikeDictDesc() != null) {
				predicates.add(criteriaBuilder.like(dictDescExpression, query.getLikeDictDesc().toMatchString(value)));
			} else {
				predicates.add(criteriaBuilder.equal(dictDescExpression, value));
			}
		}
		if (query.hasNotEqDictDesc()) {
			java.lang.String value = query.getNotEqDictDesc();
			predicates.add(criteriaBuilder.notEqual(dictDescExpression, value));
		}
		
		if (query.getInDictDesc() != null) {
			predicates.add(dictDescExpression.in(query.getInDictDesc()));
		}
		if (query.getNotInDictDesc() != null) {
			predicates.add(criteriaBuilder.not(dictDescExpression.in(query.getInDictDesc())));
		}
		if (query.getNullDictDesc() != null) {
			if (query.getNullDictDesc()) {
				predicates.add(criteriaBuilder.isNull(dictDescExpression));
			} else {
				predicates.add(criteriaBuilder.isNotNull(dictDescExpression));
			}
		}
		/**
		 * dictKeyExpression
		 */
		Expression<java.lang.String> dictKeyExpression = root.get(SysDict.PROP_DICT_KEY).as(java.lang.String.class);
		if (query.hasDictKey()) {
			java.lang.String value = query.getDictKey();
			if (query.getLikeDictKey() != null) {
				predicates.add(criteriaBuilder.like(dictKeyExpression, query.getLikeDictKey().toMatchString(value)));
			} else {
				predicates.add(criteriaBuilder.equal(dictKeyExpression, value));
			}
		}
		if (query.hasNotEqDictKey()) {
			java.lang.String value = query.getNotEqDictKey();
			predicates.add(criteriaBuilder.notEqual(dictKeyExpression, value));
		}
		
		if (query.getInDictKey() != null) {
			predicates.add(dictKeyExpression.in(query.getInDictKey()));
		}
		if (query.getNotInDictKey() != null) {
			predicates.add(criteriaBuilder.not(dictKeyExpression.in(query.getInDictKey())));
		}
		if (query.getNullDictKey() != null) {
			if (query.getNullDictKey()) {
				predicates.add(criteriaBuilder.isNull(dictKeyExpression));
			} else {
				predicates.add(criteriaBuilder.isNotNull(dictKeyExpression));
			}
		}
		/**
		 * dictValueExpression
		 */
		Expression<java.lang.String> dictValueExpression = root.get(SysDict.PROP_DICT_VALUE).as(java.lang.String.class);
		if (query.hasDictValue()) {
			java.lang.String value = query.getDictValue();
			if (query.getLikeDictValue() != null) {
				predicates.add(criteriaBuilder.like(dictValueExpression, query.getLikeDictValue().toMatchString(value)));
			} else {
				predicates.add(criteriaBuilder.equal(dictValueExpression, value));
			}
		}
		if (query.hasNotEqDictValue()) {
			java.lang.String value = query.getNotEqDictValue();
			predicates.add(criteriaBuilder.notEqual(dictValueExpression, value));
		}
		
		if (query.getInDictValue() != null) {
			predicates.add(dictValueExpression.in(query.getInDictValue()));
		}
		if (query.getNotInDictValue() != null) {
			predicates.add(criteriaBuilder.not(dictValueExpression.in(query.getInDictValue())));
		}
		if (query.getNullDictValue() != null) {
			if (query.getNullDictValue()) {
				predicates.add(criteriaBuilder.isNull(dictValueExpression));
			} else {
				predicates.add(criteriaBuilder.isNotNull(dictValueExpression));
			}
		}
		/**
		 * seqExpression
		 */
		Expression<Integer> seqExpression = root.get(SysDict.PROP_SEQ).as(Integer.class);
		if (query.hasSeq()) {
			Integer value = query.getSeq();
			if( value != null){
				predicates.add(criteriaBuilder.equal(seqExpression, value));					
			}
		}
		if (query.hasNotEqSeq()) {
			Integer value = query.getNotEqSeq();
			predicates.add(criteriaBuilder.notEqual(seqExpression, value));
		}
		
		if (query.getInSeq() != null) {
			predicates.add(seqExpression.in(query.getInSeq()));
		}
		if (query.getNotInSeq() != null) {
			predicates.add(criteriaBuilder.not(seqExpression.in(query.getInSeq())));
		}
		if (query.getNullSeq() != null) {
			if (query.getNullSeq()) {
				predicates.add(criteriaBuilder.isNull(seqExpression));
			} else {
				predicates.add(criteriaBuilder.isNotNull(seqExpression));
			}
		}
		/**
		 * createTimeExpression
		 */
		Expression<java.time.LocalDateTime> createTimeExpression = root.get(SysDict.PROP_CREATE_TIME).as(java.time.LocalDateTime.class);
		if(query.hasCreateTimeBegin() && query.getCreateTimeBegin()!= null){
			if(!query.hasCreateTimeEnd() || query.getCreateTimeEnd() == null){
				predicates.add(criteriaBuilder.greaterThan(createTimeExpression, query.getCreateTimeBegin()));
			}else{
				predicates.add(criteriaBuilder.between(createTimeExpression, query.getCreateTimeBegin(), query.getCreateTimeEnd()));
			}			
		}
		if(query.hasCreateTimeEnd() && query.getCreateTimeEnd()!=null){
			if(!query.hasCreateTimeBegin() || query.getCreateTimeBegin() == null){
				predicates.add(criteriaBuilder.lessThan(createTimeExpression, query.getCreateTimeBegin()));
			}
		}							
		if (query.hasCreateTime()) {
			java.time.LocalDateTime value = query.getCreateTime();
			if( value != null){
				predicates.add(criteriaBuilder.equal(createTimeExpression, value));					
			}
		}
		if (query.hasNotEqCreateTime()) {
			java.time.LocalDateTime value = query.getNotEqCreateTime();
			predicates.add(criteriaBuilder.notEqual(createTimeExpression, value));
		}
		
		if (query.getInCreateTime() != null) {
			predicates.add(createTimeExpression.in(query.getInCreateTime()));
		}
		if (query.getNotInCreateTime() != null) {
			predicates.add(criteriaBuilder.not(createTimeExpression.in(query.getInCreateTime())));
		}
		if (query.getNullCreateTime() != null) {
			if (query.getNullCreateTime()) {
				predicates.add(criteriaBuilder.isNull(createTimeExpression));
			} else {
				predicates.add(criteriaBuilder.isNotNull(createTimeExpression));
			}
		}
		return predicates;
	}
	public String toString() {
		return ToStringBuilder.reflectionToString(this,ToStringStyle.MULTI_LINE_STYLE);
	}
	
}

